package com.ysd.repository;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.ysd.entity.roles;

public interface RolesRepository extends JpaRepository<roles, String>,JpaSpecificationExecutor<roles> {

	/**
	 * 中间表添加角色模块
	 * @param rid 角色id
	 * @param mid  模块id
	 */
	@Modifying
	@Query(value = "insert into rolemodules VALUES(?1,?2)", nativeQuery = true)
	@Transactional
	void saveModulesrole(String rid, Integer mid);
	/**
	 * 删除角色的模块
	 * @param RoleId
	 
	 */
	@Modifying
	@Query(value = "delete from rolemodules where rid=?1", nativeQuery = true)
	@Transactional
	void delModulesrole(String rid);
}
